﻿using System;
using System.Collections.Generic;
using System.Text;

namespace EmbeddedSharp.Core.Function.Trigonometry {
    public class AtanNode : FuncNode {
        public AtanNode()
            : base() {
            base.Value = "atan";
        }

        public override FuncNode GetReversedFunction(int index) {
            return new TanNode();
        }

        public override object Evaluate() {
            if (Parameters.Count < 1) {
                throw new ArgumentException(
                    "usage: atan(number)");
            }

            double result = Convert.ToDouble(Parameters[0].Evaluate());

            return System.Math.Atan(result).ToString();
        }
    }
}
